<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class DB_ActiveRecord</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="class-name"><img src="../media/images/Class_logo.png"
														alt=" Class"
														title=" Class"
														style="vertical-align: middle"> DB_ActiveRecord</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
							<a href="#sec-descendents">Descendents</a>
			|											<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
						|											<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">DB_ActiveRecord 类</p>
<p class="description"><p>DB_ActiveRecord 类
 <pre> 基于 TableGateway 上实现的 ActiveRecord 模式</pre></p></p>
	<ul class="tags">
				<li><span class="field">author:</span> eason007&lt;<a href="mailto:eason007@163.com">eason007@163.com</a>&gt;</li>
				<li><span class="field">version:</span> 1.0.1.20100302</li>
				<li><span class="field">copyright:</span> Copyright (c) 2007-2010 eason007&lt;eason007@163.com&gt;</li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_library---db---ActiveRecord.php.html">/library/db/ActiveRecord.php</a> (line <span class="field"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a19">19</a></span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>

	<a name="sec-descendents"></a>
	<div class="info-box">
		<div class="info-box-title">Direct descendents</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
			<span class="disabled">Descendents</span>
			|												<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
								|															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
								</div>
		<div class="info-box-body">
			<table cellpadding="2" cellspacing="0" class="class-table">
				<tr>
					<th class="class-table-header">Class</th>
					<th class="class-table-header">Description</th>
				</tr>
								<tr>
					<td style="padding-right: 2em; white-space: nowrap">
						<img src="../media/images/Class.png"
								 alt=" class"
								 title=" class"
								 style="vertical-align: center"/>
						<a href="../Example/Model/Model_BlogActiveRecord.html">Model_BlogActiveRecord</a>
					</td>
					<td>
											定义 blog 表的 model 类
										</td>
				</tr>
								<tr>
					<td style="padding-right: 2em; white-space: nowrap">
						<img src="../media/images/Class.png"
								 alt=" class"
								 title=" class"
								 style="vertical-align: center"/>
						<a href="../Example/Model/Model_CategoryActiveRecord.html">Model_CategoryActiveRecord</a>
					</td>
					<td>
											定义 category 表的 model 类
										</td>
				</tr>
							</table>
		</div>
	</div>


	<a name="sec-var-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Variable Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-descendents">Descendants</a> |
						<span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
							| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
								</div>
		<div class="info-box-body">
			<div class="var-summary">
																				<div class="var-title">
					<img src="../media/images/StaticVariable.png" alt=" " />
					static <span class="var-type">mixed</span>
					<a href="#$_define" title="details" class="var-name">$_define</a>
				</div>
																								<div class="var-title">
					<img src="../media/images/StaticVariable.png" alt=" " />
					static <span class="var-type">mixed</span>
					<a href="#$_meta" title="details" class="var-name">$_meta</a>
				</div>
																												<div class="var-title">
					<img src="../media/images/Variable.png" alt=" " />
					<span class="var-type">mixed</span>
					<a href="#$_chgProps" title="details" class="var-name">$_chgProps</a>
				</div>
																								<div class="var-title">
					<img src="../media/images/Variable.png" alt=" " />
					<span class="var-type">mixed</span>
					<a href="#$_funcs" title="details" class="var-name">$_funcs</a>
				</div>
																								<div class="var-title">
					<img src="../media/images/Variable.png" alt=" " />
					<span class="var-type">mixed</span>
					<a href="#$_props" title="details" class="var-name">$_props</a>
				</div>
											</div>
		</div>
	</div>

	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-descendents">Descendants</a> |
																		<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
				 
				|
						<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																												<div class="method-definition">
					<img src="../media/images/StaticMethod.png" alt=" "/>
											static <span class="method-result">int</span>
										<a href="#destroyWhere" title="details" class="method-name">destroyWhere</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$class_name</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$args</span>)
									</div>
																<div class="method-definition">
					<img src="../media/images/StaticMethod.png" alt=" "/>
											static <span class="method-result">mixed</span>
										<a href="#find" title="details" class="method-name">find</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$class_name</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$args</span>)
									</div>
																								<div class="method-definition">
					<img src="../media/images/StaticMethod.png" alt=" "/>
											static <span class="method-result">array</span>
										<a href="#_defMeta" title="details" class="method-name">_defMeta</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$class_name</span>)
									</div>
																																				<div class="method-definition">
					<img src="../media/images/Constructor.png" alt=" "/>
											<span class="method-result">DB_ActiveRecord</span>
										<a href="#__construct" title="details" class="method-name">__construct</a>
											(<span class="var-type"></span>&nbsp;<span class="var-name">$props</span>)
									</div>
																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">bool</span>
										<a href="#destroy" title="details" class="method-name">destroy</a>
										()
									</div>
																																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">bool</span>
										<a href="#save" title="details" class="method-name">save</a>
										()
									</div>
																								<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">mixed</span>
										<a href="#__get" title="details" class="method-name">__get</a>
											(<span class="var-type">$prop_name</span>&nbsp;<span class="var-name">$prop_name</span>)
									</div>
																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">void</span>
										<a href="#__set" title="details" class="method-name">__set</a>
											(<span class="var-type">$prop_name</span>&nbsp;<span class="var-name">$prop_name</span>, <span class="var-type">$value</span>&nbsp;<span class="var-name">$value</span>)
									</div>
											</div>
		</div>
	</div>		

	<a name="sec-vars"></a>
	<div class="info-box">
		<div class="info-box-title">Variables</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-descendents">Descendents</a> |
										<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<a name="var$_define" id="$_define"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<img src="../media/images/Variable.png" />
		<span class="var-title">
			static <span class="var-type">mixed</span>
			<span class="var-name">$_define</span>
						(line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a28">28</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	
	
		
		

</div>
<a name="var$_meta" id="$_meta"><!-- --></A>
<div class="oddrow">

	<div class="var-header">
		<img src="../media/images/Variable.png" />
		<span class="var-title">
			static <span class="var-type">mixed</span>
			<span class="var-name">$_meta</span>
						(line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a26">26</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	
	
		
		

</div>

<a name="var$_chgProps" id="$_chgProps"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<img src="../media/images/Variable.png" />
		<span class="var-title">
			<span class="var-type">mixed</span>
			<span class="var-name">$_chgProps</span>
			 = <span class="var-default">array()</span>			(line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a24">24</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
<a name="var$_funcs" id="$_funcs"><!-- --></A>
<div class="oddrow">

	<div class="var-header">
		<img src="../media/images/Variable.png" />
		<span class="var-title">
			<span class="var-type">mixed</span>
			<span class="var-name">$_funcs</span>
			 = <span class="var-default">array()</span>			(line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a22">22</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
<a name="var$_props" id="$_props"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<img src="../media/images/Variable.png" />
		<span class="var-title">
			<span class="var-type">mixed</span>
			<span class="var-name">$_props</span>
			 = <span class="var-default">array()</span>			(line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a20">20</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
						
		</div>
	</div>
	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-descendents">Descendents</a> |
															<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
														<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methoddestroyWhere" id="destroyWhere"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/StaticMethod.png" />
		<span class="method-title">static destroyWhere</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a188">188</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">删除记录</p>
<p class="description"><p>删除记录
 通过 $args 的指定，删除符合的数据 返回删除记录的行数</p></p>
	
	<div class="method-signature">
		<span class="method-result">int</span>
		<span class="method-name">
			destroyWhere
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$class_name</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$args</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$class_name</span><span class="var-description">: 数据 Model 名</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$args</span><span class="var-description">: 查找的条件，与 TableGateway 的方法对应</span>			</li>
				</ul>
		
			
	</div>
<a name="methodfind" id="find"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/StaticMethod.png" />
		<span class="method-title">static find</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a144">144</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">查找数据（静态方法）</p>
<p class="description"><p>查找数据（静态方法）
 通过 $args 的指定，查找符合的数据 返回对象或对象集合</p></p>
	
	<div class="method-signature">
		<span class="method-result">mixed</span>
		<span class="method-name">
			find
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$class_name</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$args</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$class_name</span><span class="var-description">: 数据 Model 名</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$args</span><span class="var-description">: 查找的条件，与 TableGateway 的方法对应</span>			</li>
				</ul>
		
			
	</div>
<a name="method_defMeta" id="_defMeta"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/StaticMethod.png" />
		<span class="method-title">static _defMeta</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a117">117</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">获取 Model 的定义</p>
<p class="description"><p>获取 Model 的定义
 调用 Model 的 _define 方法，获取对 Model 的定义 _define 返回的为多维数组，其中 props 代表对数据库连接的定义 funcs 代表对模型的定义</p></p>
	
	<div class="method-signature">
		<span class="method-result">array</span>
		<span class="method-name">
			_defMeta
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$class_name</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$class_name</span>			</li>
				</ul>
		
			
	</div>
<a name="method__construct" id="__construct"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Constructor.png" />
		<span class="method-title">Constructor __construct</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a30">30</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	
	<div class="method-signature">
		<span class="method-result">DB_ActiveRecord</span>
		<span class="method-name">
			__construct
		</span>
					(<span class="var-type"></span>&nbsp;<span class="var-name">$props</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type"></span>
				<span class="var-name">$props</span>			</li>
				</ul>
		
			
	</div>
<a name="methoddestroy" id="destroy"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">destroy</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a244">244</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">销毁对象</p>
<p class="description"><p>销毁对象</p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">bool</span>
		<span class="method-name">
			destroy
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodsave" id="save"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">save</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a208">208</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">保存数据</p>
<p class="description"><p>保存数据
 将对象内的数据保存到数据库 如果主键属性为空，则为新增记录，否则为更新记录</p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">bool</span>
		<span class="method-name">
			save
		</span>
				()
			</div>
	
		
			
	</div>
<a name="method__get" id="__get"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">__get</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a68">68</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">获取属性（魔术方法）</p>
<p class="description"><p>获取属性（魔术方法）
 如果是对象基本属性，则直接返回。 如果是关联属性，则实时查询数据库获取。</p></p>
	
	<div class="method-signature">
		<span class="method-result">mixed</span>
		<span class="method-name">
			__get
		</span>
					(<span class="var-type">$prop_name</span>&nbsp;<span class="var-name">$prop_name</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">$prop_name</span>
				<span class="var-name">$prop_name</span>			</li>
				</ul>
		
			
	</div>
<a name="method__set" id="__set"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">__set</span> (line <span class="line-number"><a href="../__filesource/fsource_DB__librarydbActiveRecord.php.html#a50">50</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">设定属性（魔术方法）</p>
<p class="description"><p>设定属性（魔术方法）
 如果设定的属性为非主键字段，则记录到 _chgProps 属性中 以便调用 save 方法时使用</p></p>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			__set
		</span>
					(<span class="var-type">$prop_name</span>&nbsp;<span class="var-name">$prop_name</span>, <span class="var-type">$value</span>&nbsp;<span class="var-name">$value</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">$prop_name</span>
				<span class="var-name">$prop_name</span>			</li>
					<li>
				<span class="var-type">$value</span>
				<span class="var-name">$value</span>			</li>
				</ul>
		
			
	</div>
						
		</div>
	</div>

	
	<p class="notes" id="credit">
		Documentation generated on Tue, 02 Mar 2010 07:46:46 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
	</p>
	</div></body>
</html>